<html>
<head><meta charset="utf-8"><title>Help fixing #80742 · miri · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/index.html">miri</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html">Help fixing #80742</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="223087032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223087032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223087032">(Jan 18 2021 at 07:08)</a>:</h4>
<p>Hello. I started working on <a href="https://github.com/rust-lang/rust/issues/80742">#80742</a>. I don't have much experience in rustc code or in mir(i). I can see two ways of fixing this:</p>
<ul>
<li>
<p>Avoid evaluating <code>size_of::&lt;non_const_arg&gt;</code> (or the caller of it) with miri somehow because the argument is not a const. This avoids the panic in miri. I think this involves checking (before evaluating a <code>const fn</code> application in miri) that the args are also consts. (I'd expect this to be done already, but maybe the check is missing in some call sites?)</p>
</li>
<li>
<p>Evaluate it but return the error to the call site and handle it there. This returns an error value in miri instead of panicking.</p>
</li>
</ul>
<p>If I compile <code>let x: [u8; size_of::&lt;dyn X&gt;];</code> it fails with <code>the size for values of type </code>dyn Debug<code> cannot be known at compilation time</code>. I think we want to fail the same way in this issue. The question is how. Can anyone advise? Does any of the ideas above make sense? Thanks!</p>



<a name="223094249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223094249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223094249">(Jan 18 2021 at 08:57)</a>:</h4>
<p><span class="user-mention" data-user-id="119169">@osa1</span> great! the ICE message is</p>
<blockquote>
<p>SizeOf nullary MIR operator called for unsized type</p>
</blockquote>
<p>so I'd say the fix is to make the SizeOf operator support unsized types. :) So far that just wasn't necessary, but now it seems to be, and that shouldn't be very hard to do.</p>



<a name="223094268"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223094268" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223094268">(Jan 18 2021 at 08:57)</a>:</h4>
<p>that operator is implemented here: <a href="https://github.com/rust-lang/rust/blob/0677d9729318441a1cdb0c74812ec4140fa4d35f/compiler/rustc_mir/src/interpret/step.rs#L264">https://github.com/rust-lang/rust/blob/0677d9729318441a1cdb0c74812ec4140fa4d35f/compiler/rustc_mir/src/interpret/step.rs#L264</a></p>



<a name="223094286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223094286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223094286">(Jan 18 2021 at 08:57)</a>:</h4>
<p>its implementation should be more like <code>size_of_val</code>, which you can find here: <a href="https://github.com/rust-lang/rust/blob/0677d9729318441a1cdb0c74812ec4140fa4d35f/compiler/rustc_mir/src/interpret/intrinsics.rs#L143">https://github.com/rust-lang/rust/blob/0677d9729318441a1cdb0c74812ec4140fa4d35f/compiler/rustc_mir/src/interpret/intrinsics.rs#L143</a></p>



<a name="223094341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223094341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223094341">(Jan 18 2021 at 08:58)</a>:</h4>
<p>oh no wait, that makes no sense</p>



<a name="223094352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223094352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223094352">(Jan 18 2021 at 08:58)</a>:</h4>
<p><code>SizeOf</code> is a nullary operator... it <em>cannot</em> work on unsized types</p>



<a name="223094362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223094362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223094362">(Jan 18 2021 at 08:58)</a>:</h4>
<p>so this is not a Miri bug, it's a MIR construction bug</p>



<a name="223094457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223094457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223094457">(Jan 18 2021 at 09:00)</a>:</h4>
<p>so, you won't have to change anything in Miri to fix this; you'll have to change something where the MIR is being built, or change the type checker to reject more things, or something like that... I'm out of my league here. I'd suggest using the <a class="stream" data-stream-id="131828" href="/#narrow/stream/131828-t-compiler">#t-compiler</a> stream for that, since this is not Miri-related.</p>



<a name="223094594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223094594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223094594">(Jan 18 2021 at 09:01)</a>:</h4>
<p>(FWIW, "Miri" refers to <a href="https://github.com/rust-lang/miri/">Miri-the-tool</a>... the channel for compile-time evaluation questions would be <a class="stream" data-stream-id="146212" href="/#narrow/stream/146212-t-compiler.2Fconst-eval">#t-compiler/const-eval</a>... but I recognize this can be confusing^^ and anyway this issue is not about compile-time evaluation, it's about some other parts of the compiler)</p>



<a name="223094938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223094938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223094938">(Jan 18 2021 at 09:05)</a>:</h4>
<p>Thanks <span class="user-mention" data-user-id="120791">@RalfJ</span>, at least I know the problem is not the interpreter. I'll ask rest of the questions elsewhere.</p>
<blockquote>
<p>SizeOf is a nullary operator... it cannot work on unsized types</p>
</blockquote>
<p>It takes a type argument, no? Why do you say "cannot"? In the link you provided it has an argument for example (the variable <code>ty</code>).</p>



<a name="223097489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223097489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223097489">(Jan 18 2021 at 09:35)</a>:</h4>
<p>to determine the size of an unsized type you need a type argument <em>and a value argument</em></p>



<a name="223097511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223097511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223097511">(Jan 18 2021 at 09:35)</a>:</h4>
<p>like <a href="https://doc.rust-lang.org/nightly/std/mem/fn.size_of_val.html"><code>size_of_val</code> does</a></p>



<a name="223097522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223097522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223097522">(Jan 18 2021 at 09:35)</a>:</h4>
<p>the type on its own cannot be enough to determine the size since it's, well, unsized ;)</p>



<a name="223097637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223097637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223097637">(Jan 18 2021 at 09:36)</a>:</h4>
<blockquote>
<p>the type on its own cannot be enough to determine the size</p>
</blockquote>
<p>Make sense. Thanks again.</p>



<a name="223102177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223102177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223102177">(Jan 18 2021 at 10:20)</a>:</h4>
<p>Looks like this was introduced by the lowering of size_of intrinsic to the nullary SizeOf operator. Is interpreting code that isn't well typed unavoidable currently?</p>



<a name="223102693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223102693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223102693">(Jan 18 2021 at 10:26)</a>:</h4>
<p><code>size_of</code> has an implicit <code>T: Sized</code> bound, so that call would already be invalid to begin with</p>



<a name="223102779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223102779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223102779">(Jan 18 2021 at 10:26)</a>:</h4>
<blockquote>
<p>Is interpreting code that isn't well typed unavoidable currently?</p>
</blockquote>
<p>it's an issue that comes up regularly, rustc is pretty bad at "stopping" when things have gone wrong. related issue: <a href="https://github.com/rust-lang/rust/issues/79047">https://github.com/rust-lang/rust/issues/79047</a></p>



<a name="223102828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223102828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223102828">(Jan 18 2021 at 10:27)</a>:</h4>
<p>Cc <span class="user-mention" data-user-id="124288">@oli</span></p>



<a name="223127857"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223127857" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223127857">(Jan 18 2021 at 14:42)</a>:</h4>
<p>The call isn't valid, but it didn't used to cause an ICE before. Instead it succeeded computing the unsized layout, which incidently was also reported as <a href="https://github.com/rust-lang/rust/issues/80795">#80795</a>.</p>



<a name="223129005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223129005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223129005">(Jan 18 2021 at 14:52)</a>:</h4>
<p>wait, is <a href="https://github.com/rust-lang/rust/issues/80742">#80742</a> relying on this coherence bug? in that case I'd say the ICE is totally fine</p>



<a name="223129039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223129039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223129039">(Jan 18 2021 at 14:53)</a>:</h4>
<p>it makes no sense to defend the compiler against this as that would mean literally not relying on the type checker for anything...</p>



<a name="223129185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223129185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223129185">(Jan 18 2021 at 14:54)</a>:</h4>
<p>The <a href="https://github.com/rust-lang/rust/issues/80795">#80795</a> was a feature request for an ICE.</p>



<a name="223129228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223129228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223129228">(Jan 18 2021 at 14:54)</a>:</h4>
<p>Which is exactly what is happening now.</p>



<a name="223129316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223129316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223129316">(Jan 18 2021 at 14:55)</a>:</h4>
<p><span class="user-mention silent" data-user-id="352985">tm</span> <a href="#narrow/stream/269128-miri/topic/Help.20fixing.20.2380742/near/223129228">said</a>:</p>
<blockquote>
<p>Which is exactly what is happening now.</p>
</blockquote>
<p>yeah I sprinkled tons of defensive asserts all over the CTFE engine...^^</p>



<a name="223129659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223129659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223129659">(Jan 18 2021 at 14:58)</a>:</h4>
<p>If I wasn't clear, the ICE is already implemented :D.</p>



<a name="223130992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223130992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223130992">(Jan 18 2021 at 15:05)</a>:</h4>
<p>Sorry I couldn't follow the discussion. Can <a href="https://github.com/rust-lang/rust/issues/79047">#79047</a> be closed now? Is there any changes in how we think <a href="https://github.com/rust-lang/rust/issues/80742">#80742</a> should be fixed?</p>



<a name="223136433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223136433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223136433">(Jan 18 2021 at 15:49)</a>:</h4>
<p>For now I would use similar approach to how we handle invalid transmute, i.e., <code>delay_span_bug</code> while returning an error from interpreter. Does that sound ok to you <span class="user-mention" data-user-id="120791">@RalfJ</span> , <span class="user-mention" data-user-id="124288">@oli</span> ?</p>



<a name="223137759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223137759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223137759">(Jan 18 2021 at 16:01)</a>:</h4>
<p><span class="user-mention" data-user-id="352985">@tm</span>  I'd prefer to understand where this comes from first... <span class="user-mention" data-user-id="124288">@oli</span> can you confirm that this is like the <code>transmute</code> issue?</p>



<a name="223138530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223138530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223138530">(Jan 18 2021 at 16:07)</a>:</h4>
<p>but yeah I guess that's the approach we have to go with for now... we should also open an issue similar to the transmute issue though, because really this is a hack that should not be needed</p>



<a name="223140858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223140858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223140858">(Jan 18 2021 at 16:26)</a>:</h4>
<p>the actual fix should be that we register the error that occured in typeck somehwere for const eval to find it</p>



<a name="223140893"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223140893" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223140893">(Jan 18 2021 at 16:26)</a>:</h4>
<p>but for now adding more delay span bugs is fine</p>



<a name="223193829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223193829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223193829">(Jan 19 2021 at 07:21)</a>:</h4>
<p>I just submitted <a href="https://github.com/rust-lang/rust/issues/81185">#81185</a> which "fixes" this bug by using <code>delay_span_bug</code>. It seems really hacky though.</p>
<p><span class="user-mention" data-user-id="124288">@oli</span> </p>
<blockquote>
<p>the actual fix should be that we register the error that occured in typeck somehwere for const eval to find it</p>
</blockquote>
<p>I'm confused about how we can make progress even though there's a type error. Could you elaborate on this?</p>



<a name="223194115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223194115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223194115">(Jan 19 2021 at 07:26)</a>:</h4>
<blockquote>
<p>I'm confused about how we can make progress even though there's a type error. Could you elaborate on this?</p>
</blockquote>
<p>I moved this q to <a class="stream" data-stream-id="182449" href="/#narrow/stream/182449-t-compiler.2Fhelp">#t-compiler/help</a></p>



<a name="223234466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223234466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223234466">(Jan 19 2021 at 14:36)</a>:</h4>
<p>My PR is now ready.</p>
<blockquote>
<p>the actual fix should be that we register the error that occured in typeck somehwere for const eval to find it</p>
</blockquote>
<p>Where can I learn more about this? Do we do this kind of thing elsewhere in the compiler? Where? I'd like to take a look.</p>



<a name="223242845"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223242845" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223242845">(Jan 19 2021 at 15:29)</a>:</h4>
<p>well.. that's the thing. I don't know</p>



<a name="223242855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223242855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223242855">(Jan 19 2021 at 15:29)</a>:</h4>
<p>it <em>should</em> already be happening</p>



<a name="223243016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223243016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223243016">(Jan 19 2021 at 15:30)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/f09fb488f70c5965ec4f64453a6e681fbfcff56c/compiler/rustc_mir/src/const_eval/eval_queries.rs#L277-L279">https://github.com/rust-lang/rust/blob/f09fb488f70c5965ec4f64453a6e681fbfcff56c/compiler/rustc_mir/src/const_eval/eval_queries.rs#L277-L279</a> is where we bail out if the typeck tables contain an error</p>



<a name="223243059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223243059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223243059">(Jan 19 2021 at 15:30)</a>:</h4>
<p>but some errors don't seem to get registered</p>



<a name="223243070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223243070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223243070">(Jan 19 2021 at 15:30)</a>:</h4>
<p>or happen in a different stage</p>



<a name="223243179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223243179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223243179">(Jan 19 2021 at 15:31)</a>:</h4>
<p>maybe the errors we see are MIR typeck errors, meaning we may need a flag on MIR bodies that state that an error has occurred on it</p>



<a name="223243330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223243330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223243330">(Jan 19 2021 at 15:32)</a>:</h4>
<p>or we need to make the MIR opt/check pipeline fallible, so <code>optmized_mir</code> can return an <code>Result&lt;&amp;'tcx mir::Body&lt;'tcx&gt;, ErrorReported&gt;</code></p>



<a name="223243429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223243429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223243429">(Jan 19 2021 at 15:32)</a>:</h4>
<p>idk, the design space is rather large, but first we need to know what the actual problem is, so we need to track where these errors occur and why they don't cause const eval to abort evaluation</p>



<a name="223244122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223244122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223244122">(Jan 19 2021 at 15:37)</a>:</h4>
<p>Interesting. I'll try to find out why this error is not caught in the code you linked.</p>



<a name="223245684"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223245684" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223245684">(Jan 19 2021 at 15:48)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> what is the fastest way to rebuild stage 1 compiler when working MIR or const_eval parts of the compiler? I'm currently using<code> ./x.py build --stage 1</code>, with incremental compilation enabled, LLVM used from the system, debug logs are on.</p>



<a name="223246201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223246201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223246201">(Jan 19 2021 at 15:51)</a>:</h4>
<p>I mostly run tests directly, so I use <code>./x.py test src/test/ui --bless --test-args the-test-I-want-to-run</code>, which automatically picks stage 1 and uses incremental due to the <code>config.toml</code></p>



<a name="223246234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223246234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223246234">(Jan 19 2021 at 15:52)</a>:</h4>
<p>unfortunately you need the whole shebang around building libcore/libstd every time you touch the compiler</p>



<a name="223505940"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223505940" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223505940">(Jan 21 2021 at 13:18)</a>:</h4>
<p><span class="user-mention" data-user-id="119169">@osa1</span> thanks for the PR! Would be good if you could make a follow-up PR to handle <a href="https://github.com/rust-lang/rust/pull/81185#discussion_r561872007">this concern</a>. You can <code>r?</code> me on that.</p>



<a name="223508275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Help%20fixing%20%2380742/near/223508275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Help.20fixing.20.2380742.html#223508275">(Jan 21 2021 at 13:37)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> will do, thanks.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>